﻿<UserControl x:Class="Waf.BookLibrary.Library.Presentation.Views.PersonView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:p="clr-namespace:Waf.BookLibrary.Library.Presentation.Properties"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:waf="http://waf.codeplex.com/schemas"
    xmlns:vm="clr-namespace:Waf.BookLibrary.Library.Applications.ViewModels;assembly=Waf.BookLibrary.Library.Applications"
    mc:Ignorable="d" d:DataContext="{d:DesignData Source=../DesignData/SamplePersonViewModel.xaml}"
    MinWidth="250" MinHeight="122" IsEnabled="{Binding IsEnabled}"
    waf:ValidationHelper.IsEnabled="true" waf:ValidationHelper.IsValid="{Binding IsValid, Mode=OneWayToSource}">
    
    <Grid Margin="0,0,22,11">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Label Content="{x:Static p:Resources.FirstnameMenu}" Target="{Binding ElementName=firstnameBox}" Grid.Column="0" Grid.Row="0"/>
        <TextBox x:Name="firstnameBox" Text="{Binding Person.Firstname, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=true, NotifyOnValidationError=true}" 
                 MaxLength="30" Grid.Column="1" Grid.ColumnSpan="2" Margin="11,11,0,0" HorizontalAlignment="Stretch"/>

        <Label Content="{x:Static p:Resources.Lastname}" Grid.Column="0" Grid.Row="1"/>
        <TextBox Text="{Binding Person.Lastname, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=true, NotifyOnValidationError=true}" 
                 MaxLength="30" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Stretch"/>

        <Label Content="{x:Static p:Resources.Email}" Grid.Column="0" Grid.Row="2"/>
        <TextBox Text="{Binding Person.Email, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=true, NotifyOnValidationError=true}" 
                 MaxLength="100" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Stretch"/>
        <Button Command="{Binding CreateNewEmailCommand}" CommandParameter="{Binding Person, ValidatesOnNotifyDataErrors=False}" Content="{StaticResource EmailImage}" 
                ToolTip="{x:Static p:Resources.NewEmailMessage}" MinWidth="25" Margin="7,11,0,0" Grid.Column="2" Grid.Row="2" 
                UseLayoutRounding="True"/>
    </Grid>
</UserControl>
